package GenericPractice.Practice2_WriteGeneric;

import java.util.Objects;

public class Person<T> {
    private T first;
    private T last;

    public T getFirst() {
        return first;
    }

    public void setFirst(T first) {
        this.first = first;
    }

    public T getLast() {
        return last;
    }

    public void setLast(T last) {
        this.last = last;
    }

    public Person(T first, T last) {
        this.first = first;
        this.last = last;
    }

    /**
     * 静态方法
     * @param first
     * @param last
     * @param <K>
     * @return
     */
    public static <K> Person<K> create(K first, K last) {
        return new Person<K>(first, last);
    }

    public Person(Class<T> clz) throws Exception {
        this.first = clz.getDeclaredConstructor().newInstance();
        this.last = clz.getDeclaredConstructor().newInstance();
    }


    public boolean equals1(T t) {
        return this == t;
    }
}
